<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="../inc.jsp"></jsp:include>
    <meta http-equiv="X-UA-Compatible" content="edge" />
    <title>采购商押金报表</title>
    <link rel="stylesheet" href="${ctx}/css/page.css"/>
    <script type="text/javascript">
        $(function(){
            //加载表格信息
            dataGrid = $('#table').datagrid({
                url:'${ctx}/tradeList/despRepManage?temp='+Math.random(),
                striped : true,
                singleSelect : true,
                rownumbers:true,
                idField : 'flightIdList',
                pageList : [5,10,20],
                //sortName : 'id',
                //sortOrder : 'asc',
                method : 'get',
                toolbar:'#toolbar',
                pagination:true,

                columns:[[
                    {
                        width : '80',
                        title : 'id',
                        field : 'id',
                        hidden : true,
                        sortable : true
                    },{
                        width : '135',
                        title : '采购商',
                        align : 'center',
                        field : 'organizationName',
                    },{
                        width : '150',
                        title : '合同编号',
                        align : 'center',
                        field : 'contractNo',
                    },{
                        width : '200',
                        title : '航线',
                        align : 'center',
                        field : 'fc',
                        formatter : function(value,row){
                            return CommonConverter.toEmptyString(row.deptAirPort)+"-<br/>"+CommonConverter.toEmptyString(row.arrAirport);
                        }
                    },{
                        width : '120',
                        title : '产品列表',
                        align : 'center',
                        field : 'productList',
                    },{
                        width : '100',
                        title : '类型',
                        align : 'center',
                        field : 'tradeType',
                        formatter:function(value,row){
                            //	return CommonConverter.toTradeType(row.tradeType);
                            switch(row.tradeType){
                                case 0: return "票款";
                                case 1: return "冻结";
                                case 2: return "提现";
                                case 3: return "充值";
                                case 4: return "解冻";
                                default: return "未知"
                            }
                        }
                    },{
                        width : '130',
                        title : '日期',
                        align:'center',
                        field : 'createTime',
                    },{
                        width : '100',
                        title : '金额（CNY）',
                        align:'center',
                        field : 'cost',
                    },{
                        width : '120',
                        title : '剩余押金(CNY)',
                        align:'center',
                        field : 'freezeAmount'

                    }
                ] ]
            });
            //点击查询 重新加载列表
            $("#query").click(function(){
                //获取参数
                var organizationName=$("#organizationName").val();
                var contractNo=$("#contractNo").val();

                $('#table').datagrid('load',{"organizationName":organizationName,"contractNo":contractNo,"temp":Math.random()});
            });
        });
        //导出表格
        function exportExcel(){
            var organizationName=$("#organizationName").val();
            var contractNo=$("#contractNo").val();
            var url = "${ctx}/excel/exportSheets2?organizationName="+organizationName
                    +"&contractNo="+contractNo
                    +"&temp="+Math.random();
            window.location.href = url;
        };

    </script>
</head>
<body>
<jsp:include page="../head.jsp"/>
<div class="content">
    <ul class="list">
        <li>采购商：
            <input type="text" id="organizationName">
        </li>
        <li>
            合同编号：<input type="text" id="contractNo">
        <li>
        <li class="right">
            <button class='query' onclick="exportExcel()">导出</button>
        </li>
        <li class="right">
            <button class='query' id="query" style="margin-right:5px;">查询</button>
        </li>
    </ul>
    <div>
        <table id="table" class="easyui-datagrid"></table>
    </div>
</div>
<script type="text/javascript" src="${ctx }/jslib/airport/fixdiv.js"></script>
<script type="text/javascript" src="${ctx }/jslib/airport/address.js"></script>
<jsp:include page="../footer.jsp"/>
</body>
</html>